package com.icart.controller;

import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class ThymeleafController {

    @RequestMapping("/index")
    public String hello(Locale locale, Model model) {
        model.addAttribute("greeting", "Hello!");

        Date date = new Date();
        DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
        String formattedDate = dateFormat.format(date);
        model.addAttribute("currentTime", formattedDate);
        return "index";
    }

    @RequestMapping("/my")
    public String helloHtml(HashMap<String, Object> map) {
        map.put("hello", "hello");
        return "my";
    }

    @RequestMapping("/mendianList")
    public String mendianList(HashMap<String, Object> map) {
        map.put("hello", "hello");
        return "mendianList";
    }

    @RequestMapping("/mendianDetail")
    public String mendianDetail(HashMap<String, Object> map) {
        map.put("hello", "hello");
        return "mendianDetail";
    }

    @RequestMapping("/baoyang")
    public String baoyang(HashMap<String, Object> map) {
        map.put("hello", "hello");
        return "baoyang";
    }
}